package cn.sc.allinpay.allfavour.business.common.adapter;

import android.support.v7.widget.AppCompatImageView;
import android.support.v7.widget.AppCompatTextView;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import cn.pai.common.adapter.BaseRecyAdapter;
import cn.sc.allinpay.allfavour.R;
import cn.sc.allinpay.allfavour.business.common.data.SetData;

/**
 * description：设置 适配器
 * author：pany
 * on 2018/7/17 15:02
 */
public class SetAdapter extends BaseRecyAdapter<SetAdapter.MyViewHoder, SetData> {

    @Override
    public int layoutId() {
        return R.layout.item_set;
    }

    @Override
    public MyViewHoder onCreateViewHolder(View view) {
        return new MyViewHoder(view);
    }

    @Override
    public void onBindViewHolder(MyViewHoder holder, int position, SetData data) {
        holder.ivIcon.setImageResource(data.getIconId());
        holder.tvName.setText(data.getName());

    }

    class MyViewHoder extends RecyclerView.ViewHolder {

        AppCompatImageView ivIcon;//图标
        AppCompatTextView tvName;//名字


        public MyViewHoder(View itemView) {
            super(itemView);
            // TODO Auto-generated constructor stub
            ivIcon = itemView.findViewById(R.id.ivIcon);
            tvName = itemView.findViewById(R.id.tvName);
        }
    }
}
